package org.javaboy.vhr.controller.borrow;
/**
 * ClassName: ApplyInsController <br/>
 * Description: <br/>
 * date: 2020/3/2 20:16<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import org.javaboy.vhr.model.*;
import org.javaboy.vhr.service.BorrowCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 * @program: vhr
 * @description:
 * @author: hesion
 * @create: 2020-03-02 20:16
 **/
@RestController
@RequestMapping("/apply/")
public class BorrowApplyController {
    @Autowired
    BorrowCarService borrowCarService;

    @GetMapping("/userList")
    public List<Hr> getList(){

        return borrowCarService.getList();
    }

    @PostMapping("/")
    public RespBean borrow(@RequestBody BorrowCar borrowCar) throws IOException {
        if (borrowCarService.apply(borrowCar) == 1) {
            return RespBean.ok("申请成功");
        }
        return RespBean.error("申请失败");
    }


}
